<?php // Contact Us, Google Map, Address ?>
<?php
	$sql = "select a.moduleheading 
			from ms_module a 
			where 	a.stsrc = 'A' 
				and a.modulename = '".$doc_name."' 
				and a.moduleid = '".$doc_id."' 
				and a.modulestatus = 1 
			limit 0,1
			";
	$exe = mysql_query($sql) or die(mysql_error());
	$num = mysql_num_rows($exe);
	$row = mysql_fetch_array($exe);
?>
<div>
	<h2><?php if($num > 0){ echo $row['moduleheading']; } ?></h2>
</div>
<div style="padding-top:15px;">
	<div style="width:520px; float: left;">
	<?php // Google Map
		$sql = "select a.* 
				from tbl_text a 
					left join ms_module b 
						on 		a.moduleid = b.moduleid 
							and b.stsrc = 'A' 
					left join ms_module_sub c
						on b.moduleid = c.moduleid
							and c.stsrc = 'A'
				where 	a.stsrc = 'A' 
					and c.modulesubname = 'googlemap' 
					and b.moduleid = 7
					and a.textstatus = 1 
				order by a.textposition asc 
				limit 0,1
				";
		$exe = mysql_query($sql) or die(mysql_error());
		$num = mysql_num_rows($exe);
		$row = mysql_fetch_array($exe);
		
		if($num > 0)
		{
	?>
		<div>
			<iframe width="500" height="240" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="<?php echo stripslashes(html_entity_decode($row['textcontent'])); ?>&amp;output=embed"></iframe>
		</div>
	<?php
		}
	?>
		<?php // Contact Us Form ?>
		<div style="padding-top:15px;">
			<form method="post" enctype="multipart/form-data" action="<?php echo getURLdomain(); ?>/process-contactus">
				<h4>Inquiry Form</h4>
				<p>
					<?php
						$message = "";
						
						if(isset($_SESSION['valid']))
						{
							if(isset($_SESSION['notvalid']))
							{
								unset($_SESSION['notvalid']);
							}
						
							if (isset($_GET['success'])){
								if($_GET['success']==1){$message .= "Thank you. Your inquiry has been saved. We will contact you later.<br />";}
							}
						
							if(!empty($message) || $message != "")
							{
					?>
								<div style="padding:0 0 20px 0; color:blue;"><?php echo ($message); ?></div>
					<?php
							}
							session_min_destroy();
						}
						else if(isset($_SESSION['notvalid']))
						{
							if (isset($_GET['name'])){
								if($_GET['name']==1){$message .= "Please input your Name.<br />";} else
								if($_GET['name']==2){$message .= "Name format can contain letter & space only. ex : John Smith<br />";}
							}
							if (isset($_GET['address'])){
								if($_GET['address']==1){$message .= "Please input your Address.<br />";}
							}
							if (isset($_GET['email'])){
								if($_GET['email']==1){$message .= "Please input your Email.<br />";} else
								if($_GET['email']==2){$message .= "Email format wasn't entered correctly. ex : example@domain.co.id<br />";}
							}
							if (isset($_GET['inquiry'])){
								if($_GET['inquiry']==1){$message .= "Please input your Inquiry.<br />";}
							}
							if (isset($_GET['captcha'])){
								if($_GET['captcha']==1){$message .= "The reCAPTCHA wasn't entered correctly. Please try again.<br />";}
							}
							
							if(!empty($message) || $message != "")
							{
					?>
								<div style="padding:0 0 20px 0; color:red;"><?php echo ($message); ?></div>
					<?php
							}
						}
					?>
					<div>
						<table class="contact_table" border="0" cellspacing="0" cellpadding="0">								
							<tr>
								<td class="contact_td_1"><?php $string="Name";if(isset($_GET['name']) && isset($_SESSION['notvalid'])){echo "<span style='color:red;'>".$string."</span>";}else{echo $string;}; ?></td>
								<td class="contact_td_2">&nbsp;&nbsp;:&nbsp;&nbsp;</td>
								<td class="contact_td_3"><input class="txtContact" type="text" name="txt_name" value="<?php if(isset($_SESSION['name'])){ echo $_SESSION['name']; } ?>" /></td>
							</tr>
							<tr>
								<td class="contact_td_1"><?php $string="Address";if(isset($_GET['address']) && isset($_SESSION['notvalid'])){echo "<span style='color:red;'>".$string."</span>";}else{echo $string;}; ?></td>
								<td class="contact_td_2">&nbsp;&nbsp;:&nbsp;&nbsp;</td>
								<td class="contact_td_3"><input class="txtContact" type="text" name="txt_address" value="<?php if(isset($_SESSION['address'])){ echo $_SESSION['address']; } ?>" /></td>
							</tr>
							<tr>
								<td class="contact_td_1"><?php $string="Email";if(isset($_GET['email']) && isset($_SESSION['notvalid'])){echo "<span style='color:red;'>".$string."</span>";}else{echo $string;}; ?></td>
								<td class="contact_td_2">&nbsp;&nbsp;:&nbsp;&nbsp;</td>
								<td class="contact_td_3"><input class="txtContact" type="text" name="txt_email" value="<?php if(isset($_SESSION['email'])){ echo $_SESSION['email']; } ?>" /></td>
							</tr>
							<tr>
								<td class="contact_td_1"><?php $string="Message";if(isset($_GET['inquiry']) && isset($_SESSION['notvalid'])){echo "<span style='color:red;'>".$string."</span>";}else{echo $string;}; ?></td>
								<td class="contact_td_2">&nbsp;&nbsp;:&nbsp;&nbsp;</td>
								<td class="contact_td_3">
									<textarea class="txtContactMessage" name="txt_inquiry"><?php if(isset($_SESSION['inquiry'])){ echo $_SESSION['inquiry']; } ?></textarea>
								</td>
							</tr>
						</table>
						<table class="contact_table_code" border="0" cellspacing="0" cellpadding="0">								
							<tr>
								<td class="contact_td_1"><?php $string="Code";if(isset($_GET['captcha']) && isset($_SESSION['notvalid'])){echo "<span style='color:red;'>".$string."</span>";}else{echo $string;}; ?></td>
								<td class="contact_td_2">&nbsp;&nbsp;:&nbsp;&nbsp;</td>
								<td class="contact_td_3" valign="middle">
									<?php
										require_once("source/global/other/php/recaptcha-php-1.11/recaptchalib.php");
										$publickey = "6LdJztUSAAAAAPBE4PrkPTl-nG7X1Fma2uTIPVq5"; // you got this from the signup page
										echo recaptcha_get_html($publickey);
									?>
								</td>
							</tr>
						</table>
						<table class="contact_table_code" border="0" cellspacing="0" cellpadding="0">		
							<tr>
								<td class="contact_td_1"></td>
								<td class="contact_td_2"></td>
								<td class="contact_td_3"><input type="submit" value="Submit" /></td>
							</tr>
						</table>
					</div>
				</p>
			<form>
		</div>
	</div>
	<?php // Address ?>
	<div style="width:250px; float: left;">
	<?php // Get Title(Label), Single Text, View Single Text // Google Map 500 width
		$sql = "select a.* 
				from tbl_text a 
					left join ms_module b 
						on 		a.moduleid = b.moduleid 
							and b.stsrc = 'A' 
				where 	a.stsrc = 'A' 
					and b.modulename = 'address' 
					and b.moduleid = '10' 
					and a.textstatus = 1 
				order by a.textposition asc 
				limit 0,1
				";
		$exe = mysql_query($sql) or die(mysql_error());
		$num = mysql_num_rows($exe);
		$row = mysql_fetch_array($exe);
		
		if($num > 0)
		{
	?>
			<div>
				<h4><?php echo stripslashes(html_entity_decode($row['textlabel'])); ?></h4>
				<p><?php echo stripslashes(html_entity_decode($row['textcontent'])); ?></p>
			</div>
	<?php
		}
	?>
	</div>
	<div class="clear"></div>
</div>
<?php if(isset($_SESSION['notvalid'])){ session_min_destroy(); } ?>